package com.itheima.mapper;

import com.itheima.pojo.HotSetmeal;
import com.itheima.pojo.SetmealCount;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ReportDao {

    Integer selectMemNumByMonth(LocalDate localDate);


    @Select("select  t_setmeal.name as name,count(*) as value from chuanzhi.t_order  left join chuanzhi.t_setmeal  on t_setmeal.id = t_order.setmeal_id  group by  setmeal_id,t_setmeal.name")
    List<SetmealCount> selectSetmealReport();


    int selectVisitsNumByDate(@Param("queryType") String queryType, LocalDate date);

    @Select("SELECT  s.name as name, COUNT(o.setmeal_id) AS setmeal_count  FROM t_order o INNER JOIN t_setmeal s ON o.setmeal_id = s.id GROUP BY o.setmeal_id, s.name limit  4;")
    @Results({
            @Result(property = "name", column = "name"),
            @Result(property = "setmeal_count", column = "setmeal_count")
    })
    List<HotSetmeal> selectHotSetmeal();

    @Select("select count(*) from t_order ")
    int selectTotalNum();

    int selectNewMemberByDate(@Param("queryType") String queryType,LocalDate date);

    int selectOrderNumByDate(@Param("queryType") String queryType,LocalDate date);
}
